package teaching.service;

import org.springframework.stereotype.Service;
import teaching.mapper.PostMainMapper;
import teaching.mapper.PostMapper;
import teaching.pojo.Post;
import teaching.pojo.PostMain;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author:20201002983_郑雨蓓
 * Date: 2024/4/15
 * Description:
 */
@Service
public class PostService {
    @Resource
    private PostMapper postMapper;
    @Resource
    private PostMainMapper postMainMapper;

    //    所有的主题帖
    public List<Post> getAllPosts() {
        return postMapper.getAll();
    }

    //主题帖下的所有用户贴
    public List<PostMain> getPostsMains(Long postId) {
        return postMainMapper.getByPostId(postId);
    }

    public int addPost(Post post) {
        return postMapper.insertPost(post);
    }

    public int addPostMain(PostMain postMain) {
        return postMainMapper.addPostMain(postMain);
    }
}
